package com.yonder.gocommand.service.impl;

import java.text.SimpleDateFormat;
import java.util.Date;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.yonder.gocommand.dao.IOrderDAO;
import com.yonder.gocommand.entity.Order;
import com.yonder.gocommand.service.IOrderService;

@Service("OrderService")
@Transactional
public class OrderServiceImpl implements IOrderService {

	private static final Logger LOGGER = LoggerFactory.getLogger(IOrderService.class);
	private Date currentDateTime = new Date();
	private SimpleDateFormat sdf = new SimpleDateFormat("HH:mm dd/MM/yyyy");
	
	@Autowired
	private IOrderDAO orderDAO;

	@Override
	public void saveOrUpdate(Order o) {
		LOGGER.info("saveOrUpdate: " + o.getUuid()+ " " + sdf.format(currentDateTime));
		orderDAO.saveOrUpdate(o);
	}
}
